﻿using Architecture.Api.Application.Commands.CorporationCommand;
using Architecture.Domain.Services.Interface;
using Architecture.Domain.TraceabilityManage;
using MediatR;
using System.Diagnostics.Metrics;

namespace Architecture.Api.Application.CommandHandlers.CorporationHandler
{
    public class CorporationCreateCommandHandler : IRequestHandler<CorporationCreateCommand, int>
    {
        private readonly ICultureService _cultureService;

        public CorporationCreateCommandHandler(ICultureService cultureService)
        {
            _cultureService = cultureService;
        }

        public Task<int> Handle(CorporationCreateCommand request, CancellationToken cancellationToken)
        {
            return _cultureService.AddCorporation(new Corporation()
            {
                //养殖
                BreedingQuantity = request.BreedingQuantity,
                CompanyName = request.CompanyName,
                ProductionLot = request.ProductionLot,
                HeadOfBreeding = request.HeadOfBreeding,
            });
        }
    }
}
